﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Frogism.Web.Controllers
{
  
    public abstract class FrogControllerBase : Controller
    {
        public FrogControllerBase() : base(){
          //  SetNavigation(this.User);
        }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            if (this.User != null)
            {
                SetNavigation(this.User);
            }
        }
        private void SetNavigation(System.Security.Principal.IPrincipal user)
        {
            Frogism.Core.Navigation[] navs;
            if (user != null && user.Identity.Name == "topher")
            {
                navs = new Frogism.Core.Navigation[6];
                navs[0] = new Frogism.Core.Navigation() { Id = 0, Active = true, Controller = "Home", Label = "Home", Link = "" };
                navs[1] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Home", Label = "Logout", Link = "Logout" };
                navs[2] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Workout", Label = "Workout", Link = "" };
                navs[3] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Money", Label = "Money", Link = "" };
                navs[4] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Book", Label = "Books", Link = "" };
                navs[5] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Drink", Label = "Drinking", Link = "" };
            
            }else{
                navs = new Frogism.Core.Navigation[2];
                navs[0] = new Frogism.Core.Navigation() { Id = 0, Active = true, Controller = "Home", Label = "Home", Link = "" };
                navs[1] = new Frogism.Core.Navigation() { Id = 1, Active = true, Controller = "Home", Label = "Login", Link = "Login" };
          
            }

          
            ViewData["navigation"] = navs;
        }
        //protected override ViewResult View(IView view, object model)
        //{
        //}
    }
}
